package com.dou.you.che.service.impl.sys;

import com.dou.you.che.service.sys.SysLogServiceI;
import com.dou.you.che.comm.utils.IdUtil;
import com.dou.you.che.core.entity.sys.SysLog;
import com.dou.you.che.core.mapper.sys.SysLogDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * PC 管理员操作日志
 * @Author 黄国刚【1058118328@qq.com】
 */
@Service
@Transactional(readOnly = true)
public class SysLogService implements SysLogServiceI {

    @Autowired
    private SysLogDao sysLogDao;

    @Override
    public SysLog queryObject(Long id) {
        return sysLogDao.queryObject(id);
    }

    @Override
    public List<SysLog> queryList(Map<String, Object> map) {
        return sysLogDao.queryList(map);
    }

    @Override
    public int queryTotal(Map<String, Object> map) {
        return sysLogDao.queryTotal(map);
    }

    @Transactional(readOnly = false)
    @Override
    public void save(SysLog sysLog) {
        sysLog.setId(IdUtil.createIdbyUUID());
        sysLog.setCreateDate(new Date());
        sysLogDao.save(sysLog);
    }

    @Transactional(readOnly = false)
    @Override
    public void update(SysLog sysLog) {
        sysLogDao.update(sysLog);
    }

    @Transactional(readOnly = false)
    @Override
    public void delete(Long id) {
        sysLogDao.delete(id);
    }

    @Transactional(readOnly = false)
    @Override
    public void deleteBatch(Long[] ids) {
        sysLogDao.deleteBatch(ids);
    }
}
